<?php
include "lib/Import.class.php";

$CalendarID = "id@group.calendar.google.com";
$Username = "username";
$Password = "password";

// Login to Google service
$Import = new Import($Username, $Password);



// Define some templates (map event attributes to Google event attributes)
$Import->Title = "</staffel/spiel/teamheim> - </staffel/spiel/teamgast> (</staffel/liganame>)";
$Import->Location = "</staffel/spiel/teamheim>, </staffel/spiel/halle>";
$Import->Start = "</staffel/spiel/datum> </staffel/spiel/uhrzeit>";
$Import->Duration = 120; // 2 hours
$Import->UniqueKey = "</staffel/spiel/datum> </staffel/spiel/uhrzeit> </staffel/spiel/halle>";

// Add some reminders
$Import->AddReminder(Import::REMINDER_POPUP, Import::REMINDER_ONE_DAY * 3);

// Read XML file containing data for events
$Import->Read("http://www.volleyball-nordbaden.de/xml_export/spiele_1665.xml");

// Include only events e.g. for a specific title.
$Import->AddFilter("title", "this should be within the title text");

// Add events to Google calendar
$Number = $Import->Add("http://www.google.com/calendar/feeds/$CalendarID/private/full", "//spiel", Import::CONFLICT_SHIFT);

echo "Imported $Number events!";
?>
